package org.framework.edge.builder.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.framework.edge.builder.application.DockerRepositoryApplication;
import org.framework.edge.builder.application.command.docker.repository.*;
import org.framework.edge.builder.application.dto.DockerRepositoryDTO;
import org.framework.edge.builder.domain.model.docker.repository.DockerRepository;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;
/**
 * describe Docker 仓库 
 *
 * @author Jia wei Wu
 * @date 2024/08/13 07:39 晚上
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController 
 **/
@Tag(name = "Docker 仓库提供者")
@EasyController("/docker/repository")
public class DockerRepositoryProvider  {

    @Resource
    private DockerRepositoryApplication dockerRepositoryApplication;



    /**
     * describe 新增Docker 仓库
     *
     * @param dockerRepositoryStoryCommand 新增Docker 仓库     
     * @return {@link Result<DockerRepository>} Docker 仓库新增后领域对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "新增Docker 仓库")
    @PostMapping("/story")
    public Result<DockerRepository> story(@RequestBody DockerRepositoryStoryCommand dockerRepositoryStoryCommand){
        return dockerRepositoryApplication.story(dockerRepositoryStoryCommand);
    }
    /**
     * describe 批量新增Docker 仓库
     *
     * @param dockerRepositoryStoryCommandList 批量新增Docker 仓库     
     * @return {@link Result<List<DockerRepository>>} Docker 仓库新增后领域对象集合     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "批量新增Docker 仓库")
    @PostMapping("/batchStory")
    public Result<List<DockerRepository>> batchStory(@RequestBody List<DockerRepositoryStoryCommand> dockerRepositoryStoryCommandList){
        return dockerRepositoryApplication.batchStory(dockerRepositoryStoryCommandList);
    }
    /**
     * describe 更新Docker 仓库
     *
     * @param dockerRepositoryUpdateCommand 更新Docker 仓库     
     * @return {@link Result<DockerRepository>} Docker 仓库领域对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "更新Docker 仓库")
    @PutMapping("/updateOne")
    public Result<DockerRepository> updateOne(@RequestBody DockerRepositoryUpdateCommand dockerRepositoryUpdateCommand){
        return dockerRepositoryApplication.updateOne(dockerRepositoryUpdateCommand);
    }

    /**
     * describe 查询单个Docker 仓库
     *
     * @param dockerRepositoryQueryOneCommand 查询单个Docker 仓库     
     * @return {@link Result<DockerRepositoryDTO>} Docker 仓库DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "查询单个Docker 仓库")
    @GetMapping("/findOne")
    public Result<DockerRepositoryDTO> findOne(@ModelAttribute DockerRepositoryQueryOneCommand dockerRepositoryQueryOneCommand){
        return dockerRepositoryApplication.findOne(dockerRepositoryQueryOneCommand);
    }
    /**
     * describe 查询多个Docker 仓库
     *
     * @param dockerRepositoryQueryListCommand 查询多个Docker 仓库     
     * @return {@link Result<List<DockerRepositoryDTO>>} Docker 仓库DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "查询多个Docker 仓库")
    @GetMapping("/findList")
    public Result<List<DockerRepositoryDTO>> findList(@ModelAttribute DockerRepositoryQueryListCommand dockerRepositoryQueryListCommand){
        return dockerRepositoryApplication.findList(dockerRepositoryQueryListCommand);
    }
    /**
     * describe 分页查询多个Docker 仓库
     *
     * @param dockerRepositoryQueryListCommand 分页查询多个Docker 仓库     
     * @return {@link Result<LazyPage<DockerRepositoryDTO>>} 分页Docker 仓库DTO对象     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "分页查询多个Docker 仓库")
    @GetMapping("/findPage")
    public Result<LazyPage<DockerRepositoryDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                           @Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute DockerRepositoryQueryListCommand dockerRepositoryQueryListCommand){
        return dockerRepositoryApplication.findPage(size,current,dockerRepositoryQueryListCommand);
    }
    /**
     * describe 删除Docker 仓库
     *
     * @param dockerRepositoryRemoveCommand 删除Docker 仓库     
     * @return {@link Result<DockerRepository>} Docker 仓库     
     
     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "删除Docker 仓库")
    @DeleteMapping("/remove")
    public Result<DockerRepository> remove(@ModelAttribute DockerRepositoryRemoveCommand dockerRepositoryRemoveCommand){
        return dockerRepositoryApplication.remove(dockerRepositoryRemoveCommand);
    }
}